
//
//  MSRoomConsumOtionCell.m
//  觅尚
//
//  Created by No.8 on 2019/3/29.
//  Copyright © 2019 No.8. All rights reserved.
//

#import "MSRoomConsumOtionCell.h"

@implementation MSRoomConsumOtionCell

+ (instancetype)cellWithTableView:(UITableView *)tableView{
    MSRoomConsumOtionCell * cell = [tableView dequeueReusableCellWithIdentifier:[MSRoomConsumOtionCell ID]];
    cell = [[MSRoomConsumOtionCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:[MSRoomConsumOtionCell ID]];
    cell.backgroundColor = backgroundcolor;
    return cell;
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self setMember];
        
    }
    return self;
}

- (void)setMember{
    /** 图片*/
    self.photoIMG = [[UIImageView alloc] initWithFrame:CGRectMake(60 * px, 20 * px, 100 * px, 100 * px)];
    self.photoIMG.image = [UIImage imageNamed:@"酒水数据"];
    [self addSubview:self.photoIMG];
    
    
    /** 名称*/
    self.commodityLabel = [[UILabel alloc] initWithFrame:CGRectMake(ScreenWidth * 0.2, self.photoIMG.y, ScreenWidth * 0.2, self.photoIMG.height)];
    self.commodityLabel.textColor = [UIColor whiteColor];
    self.commodityLabel.text = @"百威啤酒";
    self.commodityLabel.textAlignment = NSTextAlignmentCenter;
    self.commodityLabel.font = [UIFont systemFontOfSize:SYRealValue(28 / 2)];
    [self addSubview:self.commodityLabel];
    
    
    /** 价格*/
    self.priceLabel = [[UILabel alloc] initWithFrame:CGRectMake(ScreenWidth * 0.4, self.commodityLabel.y, self.commodityLabel.width, self.commodityLabel.height)];
    self.priceLabel.textColor = self.commodityLabel.textColor;
    self.priceLabel.text = @"300";
    self.priceLabel.textAlignment = NSTextAlignmentCenter;
    self.priceLabel.font = [UIFont systemFontOfSize:SYRealValue(28 / 2)];
    [self addSubview:self.priceLabel];
    
    
    /** 数量*/
    self.countLabel = [[UILabel alloc] initWithFrame:CGRectMake(ScreenWidth* 0.6, self.commodityLabel.y, self.commodityLabel.width, self.commodityLabel.height)];
    self.countLabel.textColor = self.commodityLabel.textColor;
    self.countLabel.text = @"x2";
    self.countLabel.textAlignment = NSTextAlignmentCenter;
    self.countLabel.font = [UIFont systemFontOfSize:SYRealValue(28 / 2)];
    [self addSubview:self.countLabel];
    
    
    /** 总价*/
    self.totlepriceLabel = [[UILabel alloc] initWithFrame:CGRectMake(ScreenWidth * 0.8, self.commodityLabel.y, self.commodityLabel.width, self.commodityLabel.height)];
    self.totlepriceLabel.textColor = self.commodityLabel.textColor;
    self.totlepriceLabel.text = @"600";
    self.totlepriceLabel.textAlignment = NSTextAlignmentCenter;
    self.totlepriceLabel.font = [UIFont systemFontOfSize:SYRealValue(28 / 2)];
    [self addSubview:self.totlepriceLabel];
    
    
    self.LineView = [[UIView alloc] initWithFrame:CGRectMake(0, 140 * px - 1, ScreenWidth, 1)];
    self.LineView.backgroundColor = BackViewColor;
    [self addSubview:self.LineView];
    
}
- (void)setPrincessessModel:(MSPrincessessModel *)PrincessessModel{
    _PrincessessModel = PrincessessModel;
    [self.photoIMG sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@",PrincessessModel.preciousImage]] placeholderImage:[UIImage imageNamed:@"我的占位头像"]];
    
    self.commodityLabel.text = [NSString stringWithFormat:@"%@",PrincessessModel.preciousName];
    
    self.priceLabel.text = [NSString stringWithFormat:@"%@",PrincessessModel.preciousPrice];
    
    self.countLabel.text = [NSString stringWithFormat:@"x%@",PrincessessModel.saleCount];
    
    self.totlepriceLabel.text = [NSString stringWithFormat:@"x%@",PrincessessModel.preciousSumMoney];
}
+(NSString *)ID{
    return @"cell";
}
@end
